A barrier metal layer of a contact plug may include a Ti (titanium) layer and a TiN (titanium nitride) layer formed by Chemical Vapor Deposition (CVD). When the TiN layer is heated at a high temperature, there can be a problem that nonbonding nitrogen atoms in the TiN layer diffuse outwardly from the TiN layer. For example, when nitrogen atoms are diffused to a TiSi2 (titanium silicide) layer between a substrate and the Ti layer, the TiSi2 is decomposed by nitrogen, making it difficult to form an ohmic contact. Furthermore, there is also a problem that fluorine atoms generated in forming a tungsten (W) layer functioning as a plug material layer can diffuse to a substrate along a grain boundary in the TiN layer, or that silicon atoms in the substrate can diffuse to the W layer along the grain boundary in the TiN layer. The former diffusion may cause a void in the substrate, and the latter diffusion may cause a conversion of the W layer to a WSi layer. The aforementioned problems may increase contact resistance of the contact plug, such that the yield of a semiconductor device may be lowered.